<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:77:"/data/wwwroot/luckyDraw/m/public/../application/ordinary/view/jihuo/jihuo.php";i:1494918622;}*/ ?>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport"/>
    <title>激活联票</title>
    <link rel="stylesheet" href="<?php echo \think\Config::get('style'); ?>/wx/css/bootstrap.css">
    <link rel="stylesheet" href="<?php echo \think\Config::get('style'); ?>/wx/css/font-awesome.css">
    <link rel="stylesheet" href="<?php echo \think\Config::get('style'); ?>/wx/css/cl-style.css">
    <link rel="stylesheet" type="text/css" href="<?php echo \think\Config::get('style'); ?>/wx/city/dist/mobile-select-area.css">
    <link href="<?php echo \think\Config::get('style'); ?>/Static/hdjs/hdjs.css" rel="stylesheet" type="text/css">
</head>
<body class="cl-Forgetpasswd-bj">
<div class="container-fluid">
    <div class="row">
        <header class="cl-Forgetpasswd-header">
            <ul>
                <li class="col-xs-3"><a href="javascript:history.go(-1);" ><i class="fa fa-chevron-left"> 返回</i></a></li>
                <li class="col-xs-6 text-center"><span class="text-center">激活联票</span></li>
                <li class="col-xs-3"></li>
            </ul>
        </header>
        <h1 class="cl-tishi">激活联票 <span class=" h6 small"> <?php echo \think\Request::instance()->get('lpno'); ?></span></h1>

        <div class="cl-register-main">
            <form id="HDJS"  name="HDJS" method="post" >
                <input type="hidden"  name="ulianpiaono" value="<?php echo \think\Request::instance()->get('lpno'); ?>" id="ulianpiaono" >
                <div class="form-group">
                    <label for="username" class="sr-only">姓名</label>
                    <div class="input-group">
                        <span class="input-group-addon cl-lnput-icon"><i class="fa fa-user fa-2x"></i></span>
                        <input type="text" class="form-control" id="uname" placeholder="您的姓名" name="uname" value="<?php echo (\think\Cookie::get('v_username')) ? \think\Cookie::get('v_username') :  ''; ?>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="userId" class="sr-only">身份证号码</label>

                    <div class="input-group">
                        <span class="input-group-addon cl-lnput-icon"><i class="fa fa-shield fa-2x"></i></span>
                        <input type="text"class="form-control" name="identity" id="identity" value="<?php echo (\think\Cookie::get('v_shenfenid')) ? \think\Cookie::get('v_shenfenid') :  ''; ?>" placeholder="身份证号码" onblur="ajax_identity(0)">
                        <input type="hidden" value="1" id="cl1" name="cl1" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="account" class="sr-only">手机号</label>

                    <div class="input-group">
                        <span class="input-group-addon cl-lnput-icon"><i class="fa fa-mobile fa-2x"></i></span>
                        <?php if(empty(\think\Session::get('user.uid')) || ((\think\Session::get('user.uid') instanceof \think\Collection || \think\Session::get('user.uid') instanceof \think\Paginator ) && \think\Session::get('user.uid')->isEmpty())): ?>
                            <input type="text"class="form-control" name="mobile" id="mobile" value="" placeholder="请输入注册手机号" onchange="ajax_phone()" >
                            <?php else: ?>
                            <input type="text"class="form-control" name="mobile" id="mobile"  value="<?php echo \think\Session::get('user.phone'); ?>" readonly>
                        <?php endif; ?>
                        <input type="hidden" value="1" id="phone_cnt" name="phone_cnt" />
                        <input type="hidden" value="1" id="phone_info2" name="phone_info2" />
                        <input type="hidden" value="1" id="cl" name="cl" />
                        <input type="hidden" value="1" id="phone-info" name="phone-info" />
                    </div>
                </div>
                <?php if(empty(\think\Session::get('user.uid')) || ((\think\Session::get('user.uid') instanceof \think\Collection || \think\Session::get('user.uid') instanceof \think\Paginator ) && \think\Session::get('user.uid')->isEmpty())): ?>
                    <div class="form-group">
                        <label for="yanzhengma" class="sr-only">验证码</label>

                        <div class="input-group">

                            <input type="text" class="form-control" name="phone_code" id="phone_code" placeholder="输入验证码" onkeyup="ajax_yanzhengma()">

                            <span class="input-group-addon">
                               <a id="get_code">点击获取</a>

                            </span>
                        </div>
                    </div>
                <?php endif; ?>
                <div class="form-group">
                    <div class="container-fluid text-center">
                        <label class="radio-inline cl-sex">
                            <input type="radio" name="sex" checked id="inlineRadio1" value="男"> 男士
                        </label>
                        <label class="radio-inline cl-sex">
                            <input type="radio" name="sex" id="inlineRadio2" value="女"> 女士
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label for="txt_area" class="sr-only">所在地</label>

                    <div class="input-group">
                        <span class="input-group-addon cl-lnput-icon"><i class="fa fa-map-marker fa-2x"></i></span>
                        <input type="text" class="form-control" id="txt_area" value="" placeholder="点击选择您的所在城市" />
                        <input type="text" id="hd_area" name="hd_area" value="" style="display:none"/>

                    </div>
                </div>

                <div class="form-group">
                    <button type="submit" class="btn btn-block btn-warning " onclick="return confirm_jihuo()" >确认</button>
                    <!--  状态成功后disabled标签被删除 -->
                </div>


                <div class="form-group">
                    <p class="small text-center">警告：联票为实名制产品，因虚假注册造成的一切后果，本公司概不负责！</p>
                    <p class="small text-center cl-agreement-link">注册及视为同意<a class="" href="#">超旅联票服务条款</a>
                    </p>

                </div>


            </form>


        </div>
    </div>
</div>


</body>

<script type="text/javascript" src="<?php echo \think\Config::get('style'); ?>/wx/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="<?php echo \think\Config::get('style'); ?>/wx/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo \think\Config::get('style'); ?>/wx/city/src/require.js"></script>
<script type='text/javascript' src='<?php echo \think\Config::get('style'); ?>/Static/hdjs/hdjs1.min.js'></script>
<script>
    requirejs.config({
        //By default load any module IDs from js/lib
        baseUrl: '<?php echo \think\Config::get('style'); ?>/wx/city/src',
        paths: {
            $: 'jquery-1.11.2',
            dialog:'dialog',
            'mobile-select-area':'mobile-select-area'
        }
    });
    require(['mobile-select-area','$'], function(MobileSelectArea,$) {
        var selectArea = new MobileSelectArea();
        selectArea.init({trigger:'#txt_area',value:$('#txt_area').val(),data:'<?php echo \think\Config::get('style'); ?>/wx/data.json'});
    });
</script>
<script>
    $(function () {
        $('#HDJS').validate({
            <?php if(empty(\think\Session::get('user.uid')) || ((\think\Session::get('user.uid') instanceof \think\Collection || \think\Session::get('user.uid') instanceof \think\Paginator ) && \think\Session::get('user.uid')->isEmpty())): ?>
            phone_code:{
            rule:{
                required:true
            },
            error:{
                required:'请填写验证码'
            },
            success:'验证通过'
        },
        <?php endif; ?>
        uname: {
            rule: {
                required: true
            },
            error: {
                required: '真实姓名不能为空'
            }
        },
        mobile: {
            rule: {
                phone: true
            },
            error: {
                phone: '手机号错误'
            }
        },
        identity: {
            rule: {
                required: true
            },
            error: {
                required: '身份证号不能为空'
            }
        }
    })
    })
</script>
<script>
    function ajax_test() {
        var url="<?php echo url('isTrue'); ?>";
        var datastr="lianpiaono="+$.trim($("#ulianpiaono").val());
        $.ajax({
            url: url,
            data: datastr,
            type: "POST",
            dataType: "json",
            success: function(data) {
                if (data.status==0) {
                    $("#hd_ulianpiaono").attr('class','hd-validate-error');
                }
                $("#hd_ulianpiaono").html(data.msg);
            }
        });
    }
    function ajax_identity() {
        var url="<?php echo url('idvery'); ?>";
        var datastr="identity="+$.trim($("#identity").val());
        if($("#identity").val()!=""){
            $.ajax({
                url: url,
                data: datastr,
                type: "POST",
                dataType: "json",
                success: function(data) {
                    if (data.status==0) {
                        $("#hd_identity").attr('class','hd-validate-error');
                        $("#hd_identity").html(data.message);
                    }
                }
            });
            $.ajax({
                url: "<?php echo url('idcard'); ?>",
                data: "idcard="+$.trim($("#identity").val()),
                type: "POST",
                dataType: "json",
                success:function(data){
                    if(data.status==0){
                        $("#cl1").val(0);
                        $("#phone_info2").val(data.message);
                        alert(data.message);
                    }else{
                        $("#cl1").val(1);
                    }
                }
            });
        }
    }
    function ajax_phone() {
        var url="<?php echo url('phone_count'); ?>";
        var datastr="mobile="+$.trim($("#mobile").val())+"&lianpiaono="+$.trim($("#ulianpiaono").val());
        var phone=document.getElementById("mobile");
        if(phone.value.length==11){
            //手机号正则判断
            if(!(/^1[3|4|5|7|8]\d{9}$/.test(phone.value))){
                $("#phone-info").val(0);
                alert('手机号格式不正确，请输入正确的手机号');
                return;
            }else{
                $("#phone-info").val(1);
            }
            $.ajax({
                url: url,
                data: datastr,
                type: "POST",
                dataType: "json",
                success: function(data) {
                    if (data.status==0){
                        if(data.cl==1){
                            $("#phone_cnt").val(0);
                            $("#cl").val(1);
                            $("#phone_info2").val(data.info2);
                            alert(data.info1);
                        }else{
                            $("#cl").val(0);
                            $("#phone_info2").val(data.message);
                            alert(data.message);
                        }
                    }else if(data.status==1){
                        $("#phone_cnt").val(1);
                        $("#cl").val(1);
                    }

                }
            });
        }
    }
    function ajax_yanzhengma() {
        var url = "<?php echo url('checkyanzhengma'); ?>";
        var datastr = "code=" + $.trim($("#phone_code").val()) + "&phone=" + $.trim($("#mobile").val());
        if ($.trim($("#phone_code").val()) != '') {
            $.ajax({
                url: url,
                data: datastr,
                type: "POST",
                dataType: "json",
                success: function(data) {
                    if (data.status == 1) {
                        $("#hd_phone_code").html(data.msg);
                        $('#hd_phone_code').removeClass('hd-validate-error');
                        $('#hd_phone_code').addClass('hd-validate-success');
                        $('#hd_phone_code').css('display','none');
                        return true;
                    } else {
                        $("#hd_phone_code").html(data.msg);
                        $('#hd_phone_code').removeClass('hd-validate-success');
                        $('#hd_phone_code').addClass('hd-validate-error');
                        return false;
                    }
                }
            });
        }

    }
    var count=0;
    var sum = 60;
    //获得手机验证码
    $('#get_code').click(function() {
        var num=$('#mobile').val().length;
        if( num<11 || num>11 ){
            return false;
        }
        if(count>0 && count<=60){
            return false;
        }
        var send_obj = $(this);
        var url = "<?php echo url('getCode'); ?>";
        var datastr = "phone=" + $.trim($("#mobile").val());
        $.ajax({
            url: url,
            data: datastr,
            type: "POST",
            dataType: "json",
            success: function(data) {
                if(data.status==1){
                    //60秒后重新启动发送按钮
                    var i = setInterval(function() {
                        if (count > sum) {
                            send_obj.html('发送验证码');
                            clearInterval(i);
                        } else {
                            send_obj.html('剩余' + parseInt(sum - count) + '秒');
                        }
                        count++;
                    }, 1000);
                    count=0;
                }else{
                    alert(data.msg);
                }
            }
        });
    });

    function confirm_jihuo(){
        var flag=document.getElementById("phone_cnt");
        var cl=document.getElementById("cl");
        if($('#hd_area').val()==''){
            alert('请选择地区');
            return false;
        }
        if($("#phone-info").val()==0){
            alert("手机号格式不正确，请输入正确的手机号");
            return false;
        }
        if(cl.value==0 || cl1.value==0){
            alert($("#phone_info2").val());
            return false;
        }else{
            if(flag.value==0){
                return confirm($("#phone_info2").val());
            }else{
                return true;
            }
        }
    }
    $(function(){

        ajax_phone();
        ajax_identity();
    });

</script>
</html>